package game;


public class Enemy extends Entity {
    
    /** placeholder to make enemy fire once per second */
    private int lastFired;
    public static final int MAX_ENERGY = 100;
    private int energy;
    private int wastedEnergy;
    
    public Enemy(float x, float y, Boundary bounds) {
	super(x,y, bounds);
	lastFired = 100;
	energy = 30;
	velocity = 2;
	wastedEnergy=0;
    }

    @Override
    public void update() {
	if (energy < MAX_ENERGY) {
	    energy+=3;
	    lastFired++;
	}
	if (canMove()) {
	    x+=velocity * Math.cos(angle);
	    y+=velocity * Math.sin(angle);
	} else {
	    angle = bounds.getBounceAngle(canMoveX(), canMoveY(), angle);
	}
    }
    
    public int getEnergy() {
	return energy;
    }
    
    public void setEnergy(int energy) {
	this.energy = energy;
    }
    
    public int getLastFired() {
	return lastFired;
    }
    
    public void incrementLastFired() {
	lastFired++;
    }
    
    public void resetLastFired() {
	lastFired = 0;
    }
    
    public int getCollisionRadius() {
	return 10;
    }

    public void wasteEnergy() {
	wastedEnergy++;
	energy = 0;
    }
    public int getWastedEnergy() {
	return wastedEnergy;
    }
    public void resetWastedEnergy() {
	wastedEnergy = 0;
    }
    
}
